<?php
/*----------------------------------------------------------------------
 * Kmi业务控制器
 * Author: ming.nie
----------------------------------------------------------------------*/

namespace Home\Controller;
use Think\Controller;

class KmiController extends Controller
{
    //批量生成测试key
    public function batchCreateCinemaHost()
    {
        echo "batchCreateCinemaHost<br/>\r\n";
        echo '<pre>';
        $current_time = time();
        
        $content = file_get_contents(ROOT_PATH.'/kmi_vpn_rand_test_key_data.log');
        $content = json_decode($content, true);
        
        $model = M('CinemaHost');
        $total_number = 1;
        foreach($content as $key => $value) {
            $params = array();
            $params['cinema_name'] = 'Kmi正式环境测试-'.$value['host_name'];
            $params['host_name'] = $value['host_name'];
            $params['host_ip'] = $value['vpn_ip'];
            $params['type'] = 3;
            $params['create_user_id'] = 1;
            $params['create_time'] = $current_time;
            $params['update_user_id'] = 1;
            $params['update_time'] = $current_time;
            print_r($params);
            echo "\r\n";
            $result = $model->data($params)->add($params);
            print_r($result);
            $total_number++;
            sleep(1);
        }
    }
    
    //批量生成正式key
    public function batchCreateCinemaHostZs()
    {
        echo "batchCreateCinemaHostZs<br/>\r\n";
        echo '<pre>';
        $current_time = time();
        
        $content = file_get_contents(ROOT_PATH.'/kmi_vpn_rand_formal_key_data.log');
        $content = json_decode($content, true);
        
        $model = M('CinemaHost');
        $total_number = 1;
        foreach($content as $key => $value) {
            $params = array();
            $params['cinema_name'] = 'Kmi正式环境-'.$value['host_name'];
            $params['host_name'] = $value['host_name'];
            $params['host_ip'] = $value['vpn_ip'];
            $params['type'] = 3;
            $params['create_user_id'] = 1;
            $params['create_time'] = $current_time;
            $params['update_user_id'] = 1;
            $params['update_time'] = $current_time;
            print_r($params);
            echo "\r\n";
            $result = $model->data($params)->add($params);
            print_r($result);
            $total_number++;
            sleep(1);
        }
    }
}